package com.java.base.synthetic;

import com.java.base.bridge.SonString;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class TestIsSynthetic {

    public static void main(String[] args) throws NoSuchMethodException {
        System.out.println(Synthetic.class.isSynthetic());

        Object o = Proxy.newProxyInstance(TestIsSynthetic.class.getClassLoader(), new Class[]{SynInterface.class}, new TestInvocation());

        System.out.println(o.getClass().isSynthetic());

        Method method = SonString.class.getMethod("bridge", Object.class);
        System.out.println(method.isSynthetic());

    }

    public class Synthetic{

    }

    public interface SynInterface{
        void test();
    }

    public static class TestInvocation implements InvocationHandler{

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            return "TestInvocation";
        }
    }

}
